#!/usr/bin/env pytho      
# -*- coding: utf-8 -*-
# @Author  : junpeng_chen
# @Time    : 2023/7/28 20:13
# @File    : cond_conn_op
# @annotation    : cond_conn_op字段识别
from utils.log import logger


class CondConnOpRecognition:
    def __init__(self):
        pass

    def conn_op_recognition(self, conds):
        try:
            cond_conn_op = ""
            cond_len = len(conds)
            if cond_len > 2:
                cond_conn_op = ["and"] * (len(conds) - 1)
            elif cond_len == 2:
                cond_conn_op = "and"

            return {"cond_conn_op": cond_conn_op}
        except Exception as err:
            logger.error("conn_op recognition error[{}]: {}".format(type(err), str(err)))
            raise
